LIB_TARGET = libmod_search.so

DEBUG = y

ifeq ($(DEBUG), y)
	CFLAGS := -Wall -g -O2 -fPIC -D_DEBUG -D_DEBUG_TIME
else
	CFLAGS := -O2 -fPIC -Wall
endif

CFLAGS += -D_SN_LINUX
CC = gcc

APACHE_HOME = /home/hongzx/apache2
SYSTEM_UTILS_HOME := /usr/lib

CFLAGS +=  -I$(APACHE_HOME)/include 

SRC += $(wildcard *.c)
OBJS := $(patsubst %.c, %.o, $(SRC))
LIB_OBJS = $(OBJS)

.PHONY: all install clean

all: $(LIB_TARGET)

%.o: %.c
	$(CC) $(CFLAGS) -c $<

$(LIB_TARGET): $(LIB_OBJS)  
	$(CC) $(CFLAGS) -shared -o $(LIB_TARGET) $(LIB_OBJS) $(MOD_LIB) 

#$(MOD_TEST) : $(MOD_TEST_OBJ)
#	$(CC) $(CFLAGS) -o $@ $^ $(MOD_TEST_LIB) 
#	
#	@if [ ! -d ../../bin/new_module_test/ ]; then \
#		mkdir ../../bin/new_module_test/; \
#	fi
#	cp $@ ../../bin/new_module_test/
	 

install: $(LIB_TARGET)
	rm -f $(APACHE_HOME)/modules/$(LIB_TARGET)
	cp $(LIB_TARGET) $(APACHE_HOME)/modules

clean:
	rm -f *.o
	rm -f *.so
